package com.example.rabbitmqspringboot.consumer;

import com.example.rabbitmqspringboot.constant.DelayQueueOneConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.time.LocalTime;

import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @auther teacher
 * @date 2024/4/3
 * @project rabbitmqSpringBoot
 */


@Slf4j
@Component
public class DelayConsumer {

    @RabbitListener(queues = DelayQueueOneConstant.DELAY_QUEUE)
    public void receiveD(Message message, Channel channel) throws Exception {
        String msg = new String(message.getBody());
        log.info("当前时间：{},收到延迟队列信息{}", LocalTime.now(), msg);
    }

}
